<?php
require_once '../../includes/classes/core.php';
$action 	=  $_REQUEST['act'];
$barcode    =  $_REQUEST['barcode'];
$error      =  ''; 

switch ($action) {
    case 'get_list':      	
        $rResult = mysql_query("
            SELECT   warehouse_detail.barcode,
			         persons.`name`,	
			         cartridge_parts_type.`name`,
			         warehouse_producing.date
            FROM warehouse_detail
            JOIN warehouse_producing ON warehouse_producing.warehouse_detail_id=warehouse_detail.id
            JOIN persons ON persons.id=person_id
            JOIN cartridge_parts_type ON cartridge_part_id=cartridge_parts_type.id
            WHERE  barcode in($barcode)
                    ORDER BY date DESC
            ");
        if (mysql_num_rows($rResult)>0) {    	
            while ( $aRow = mysql_fetch_array( $rResult ) ) {               
                $data['aaData'][] = $aRow;     }        
        } else  $error =  "შტრიხკოდი არასწორია";
break;
default:
	       	$error =  "null";
	}


$data['error'] = $error;
echo json_encode( $data );	